﻿{layout:default} {class:Shop.Admin.theme.Advert}
<lbhead>
    <title>
        <%=theme.Name %>-<%=Tag("主题管理")%>-<%=site.title%></title>
</lbhead>
<lbfile>
    <script type="text/javascript" src="<%=site.AdminJsPath %>/ajaxfileupload.js"></script>
</lbfile>
<lbpath>
    <div class="tools">
        <ul>
            <%if (PageReturnMsg == ""){%>
            <li class="add"><a href="javascript:void(0);" onclick="Editobj(<%=theme.id %>,0);"><b></b><span><%=Tag("添加")%></span></a></li>
            <li class="language"><a href="javascript:void(0);" onclick="Update(<%=theme.id %>,0,'Advert');"><b></b><span><%=Tag("语言")%></span></a></li>
            <%}%>
            <li class="name"><span id="navIgation">
                <%=Tag("当前位置")%>：<a href="<%=site.AdminPath %>/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0"><%=Tag("管理首页")%></a>
                > <a href="<%=site.AdminPath %>/theme/default.aspx">
                    <%=Tag("主题管理")%></a> >
                <%=theme.Name %>
                >
                <a href="Advert.aspx?id=<%=theme.id %>"><%=Tag("广告位") %></a></span></li>
        </ul>
    </div>
</lbpath>
<lbbody>
    <div class="searchbox">
        <input name="key" type="text" id="key" class="input-query" value="<%=key %>" onkeydown="if(event.keyCode==13){search_();}" /><input
            type="button" id="btnSou" class="btn-query" onclick="search_();" align="absmiddle" />
    </div>
    <table class="datalist">
        <tr class="title">
            <th style="width: 40px" class="selectAll">
                <a href="javascript:void(0);" onclick="$('input[name=\'id\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));"><%=Tag("全选")%></a>
            </th>
            <th style="width: 150px;">
                <%=Tag("代码")%>
            </th>
            <th style="width: 150px;">
                <%=Tag("说明")%>
            </th>
            <th style="width: 100px;">
                <%=Tag("尺寸")%>
            </th>
            <th style="width: 70px;">
                <%=Tag("图片数")%>
            </th>
            <th style="width: 70px;">
                <%=Tag("排序")%>
            </th>
            <th>
                <%=Tag("操作")%>
            </th>
        </tr>
        <%foreach (Shop.Model.Lebi_Theme_Advert model in models)
          {%>
        <tr class="list" ondblclick="Editobj(<%=theme.id %>,<%=model.id %>);">
            <td style="text-align:center">
                <input type="checkbox" name="id" update="true" value="<%=model.id %>" />
            </td>
            <td>
                {AD:<%=model.Code %>}
            </td>
            <td>
                <%=model.Description %>
            </td>
            <td>
                <%=model.Width+" * "+model.Height%>
            </td>
            <td>
                <a href="AdvertList.aspx?tid=<%=theme.id %>&id=<%=model.id %>"><%=Shop.Bussiness.B_Lebi_Advert.Counts("Theme_Advert_id=" + model.id) %></a>
            </td>
            <td>
                <%=model.Sort %>
            </td>
            <td>
                <a href="javascript:void(0)" onclick="Editobj(<%=theme.id %>,<%=model.id %>);">
                    <%=Tag("编辑")%></a> | <a href="javascript:void(0)" onclick="Advert_Del(<%=model.id %>);">
                        <%=Tag("删除")%></a> | <a href="AdvertList.aspx?tid=<%=theme.id %>&id=<%=model.id %>">
                            <%=Tag("图片列表")%></a> | <a href="javascript:void(0)" onclick="AdvertImage(<%=model.id %>,0);">
                            <%=Tag("添加图片")%></a>
            </td>
        </tr>
        <%} %>
    </table>
    <script type="text/javascript">
        function search_() {
            var key = $("#key").val();
            window.location = "?id=<%=id%>&key=" + escape(key);
        }
        function Editobj(tid,id) {
            var title_ = "<%=Tag("编辑")%>";
            if (id == 0)
                var title_ = "<%=Tag("添加")%>";
            var url_ = "advert_edit_window.aspx?id="+id+"&tid="+tid;
            var width_ = 650;
            var height_ = "auto";
            var modal_ = true;
            EditWindow(title_, url_, width_, height_, modal_);
        }
        function Update(id,ids,table) {
            var title_ = "<%=Tag("设置语言")%>";
            if (ids == 0)
                ids = GetChkCheckedValues("id");
            var url_ = "<%=site.AdminPath %>/config/setlanguage_edit_window.aspx?id=" + id+"&ids=" + ids+"&table="+table;
            var width_ = 400;
            var height_ = "auto";
            var modal_ = true;
            EditWindow(title_, url_, width_, height_, modal_);
        }
        function AdvertImage(aid,id) {
            var title_ = "<%=Tag("编辑")%>";
            if (id == 0)
                var title_ = "<%=Tag("添加")%>";
            var url_ = "advertimage_edit_window.aspx?id=" + id+"&aid="+aid;
            var width_ = 700;
            var height_ = "auto";
            var modal_ = true;
            EditWindow(title_, url_, width_, height_, modal_);
        }
        function Advert_Del(id) {
            if (!confirm("<%=Tag("确认要删除吗？")%>"))
                return false;
            var postData = { "id": id };
            var url="<%=site.AdminPath %>/ajax/ajax_theme.aspx?__Action=Advert_Del";
            RequestAjax(url,postData,function(res){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
    </script>
</lbbody>
<lbbottom>
    <div class="bottom" id="body_bottom">
        <%=PageString%>
    </div>
</lbbottom>